/**
* 时间秒数格式化
* @param s 时间戳（单位：秒）
* @returns {*} 格式化后的时分秒
*/
var sec_to_time = function(s,shrink) {
    var t;
    var hour = Math.floor(s/3600);
    var min = Math.floor(s/60) % 60;
    var sec = s % 60;
    if(shrink){
        if(s > -1){
            if( 1<= hour && hour < 10) {
                t = '0'+ hour + ":";
            } else if(hour ===0){
                t = ""
            }else {
                t = hour + ":";
            }

            if(t!=""){
                if(min < 10){
                    t += "0";
                }
                t += min + ":";    
            }else{
                if(min!=0){
                    if(min < 10){
                        t += "0";
                    }
                    t += min + ":";
                }else{
                    t= ""
                }
                
            }

            if(sec < 10){
                t += "0";
            }
            t += sec.toFixed(0);
        }
    }else{
        if(s > -1){
            if(hour < 10) {
                t = '0'+ hour + ":";
            } else {
                t = hour + ":";
            }
    
            if(min < 10){
                t += "0";
            }
            t += min + ":";
            if(sec < 10){
                t += "0";
            }
            t += sec.toFixed(0);
        }
    }
    return t;
}
module.exports = sec_to_time